Skip to content

[codex] Fix MiniMax CN percent-only usage rows#539

Merged
robinebers merged 1 commit into
mainfrom
codex/minimax-cn-percent-followup
Jun 2, 2026
Merged

[codex] Fix MiniMax CN percent-only usage rows#539
robinebers merged 1 commit into
mainfrom
codex/minimax-cn-percent-followup

Conversation

@robinebers
Copy link
Copy Markdown
Owner

@robinebers robinebers commented Jun 2, 2026

Summary

Context

References #531. This keeps the follow-up small and avoids merging the stale #531 branch after #534 changed the same parser.

The commit includes:

Co-authored-by: lyizhou <yiouliu2333@gmail.com>

Validation

  • bun run test -- plugins/minimax/plugin.test.js --run

Summary by cubic

Fixes MiniMax CN Token Plan parsing to avoid showing limit 0 and correctly handle percent-only responses when counts are missing. Also updates docs to the new Token Plan endpoints and documents the percent output.

  • Bug Fixes
    • Skip CN count rows that would display as limit 0 after model-call-to-prompt scaling.
    • Fall back to current_interval_remaining_percent when totals are missing; prefer model_name: "general".
    • In percent mode, set used = 100 - remaining_percent, limit = 100, and keep the reset time.
    • Add tests for CN percent fallback and ordering.

Written for commit 8fc2165. Summary will update on new commits.

Review in cubic


Note

Low Risk
Scoped to MiniMax usage display parsing and provider docs; no auth or shared infrastructure changes.

Overview
Updates the MiniMax provider docs for the Token Plan remains API and documents when the Session line uses percent instead of prompt counts.

The plugin no longer picks the first model_remains row with a positive raw total. For CN, it ignores count rows whose totals would show as limit 0 after model-call-to-prompt scaling (e.g. tiny video rows). When no displayable count exists, it uses current_interval_remaining_percent, preferring model_name: "general", and emits a percent progress line (used = 100 - remaining_percent, limit = 100). New tests cover CN percent-only payloads and row ordering.

Reviewed by Cursor Bugbot for commit 8fc2165. Bugbot is set up for automated code reviews on this repo. Configure here.

Summary by CodeRabbit

Release Notes

  • Documentation

    • Updated MiniMax integration documentation to reflect Token Plan API endpoint changes and enhanced token usage reporting options.
  • Improvements

    • Enhanced token usage tracking with improved support for percent-based remaining values as a fallback when count-based data is unavailable, improving reliability across different token counting methods.

Port the MiniMax CN percent-only quota handling from #531 onto the post-#534 Token Plan parser.

Co-authored-by: lyizhou <yiouliu2333@gmail.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 2, 2026

Review Change Stack

📝 Walkthrough

Walkthrough

The MiniMax provider plugin is updated to support token remaining information as percent-based values when count-based totals are missing or not displayable after endpoint-aware scaling. Documentation reflects Token Plan API endpoints; implementation adds fallback logic; tests verify behavior.

Changes

MiniMax Token Plan Remaining Percent Fallback

Layer / File(s) Summary
API Contract and Input/Output Schema
docs/providers/minimax.md
Documentation updated to reflect Token Plan remains API with region-specific endpoints (www.minimax.io global, api.minimaxi.com CN), documents optional current_interval_remaining_percent payload field, and extends output Session mapping to support percent-based format when count totals are unavailable, deriving used and limit from percent values.
Display Multiplier and Fallback Selection Logic
plugins/minimax/plugin.js
parsePayloadShape selection logic becomes endpoint-aware via displayMultiplierForSelection, derives hasDisplayableCount from total and display multiplier, and falls back to percent-based candidates (preferring model_name === "general") when no count is displayable. Early return prevents count-based path from running with non-displayable totals.
Percent-Based Fallback Test Coverage
plugins/minimax/plugin.test.js
Two new test cases: one validates CN remaining-percent fallback when count totals are zero/unavailable, the other validates fallback when small count rows precede the general row. Both assert computed used, limit, percent format, and resetsAt.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • robinebers/openusage#534: Modifies the same parsePayloadShape function in Token Plan remains parsing and percent-mode derivation logic with related test expectations.

Suggested reviewers

  • davidarny
  • validatedev
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title '[codex] Fix MiniMax CN percent-only usage rows' accurately reflects the main change: handling MiniMax CN percent-only quota fallback behavior. It is specific, concise, and directly related to the primary objective of the PR.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/minimax-cn-percent-followup

Comment @coderabbitai help to get the list of available commands and usage tips.

@robinebers robinebers marked this pull request as ready for review June 2, 2026 10:44
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

Re-trigger cubic

@robinebers robinebers merged commit e432468 into main Jun 2, 2026
5 checks passed
@robinebers robinebers deleted the codex/minimax-cn-percent-followup branch June 2, 2026 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant